/**
 * Created by chengming on 18/5/27.
 * version 1.0
 */
const BaseJsonAdapter = require('../base/BaseJsonAdapter');
const iconv = require("iconv-lite");

/**
 * 农业部
 */
module.exports = class Agriculnews extends BaseJsonAdapter {

  async reqJson() {
    let contents = []
    const body = await this.doRequest();
    let decodeBody = iconv.decode(body, this.encoding).toString();
    let datas = JSON.parse(decodeBody);
    datas.forEach(data => {
      contents.push({ title: data.title, href: data.link })
    })
    return { data: contents };
  }

}
